package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "web_all支付控制器")
@Controller
public class PaymentController {
    @Autowired
    private OrderFeignClient orderFeignClient;

    @ApiOperation("提交订单后，选择支付方式进行支付")
    @GetMapping("pay.html")
    public String paymentPage(HttpServletRequest request){
        String orderId = request.getParameter("orderId");
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(Long.parseLong(orderId));
        request.setAttribute("orderInfo",orderInfo);

        return "payment/pay";
    }

    @ApiOperation("支付扫码后，显示支付成功")
    @GetMapping("pay/success.html")
    public String success() {
        return "payment/success";
    }




}
